package com.kd.eb.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.kd.eb.mapper.EbProductCategoryMapper;
import com.kd.eb.mapper.EbProductMapper;
import com.kd.eb.model.EbProduct;
import org.springframework.stereotype.Service;
import org.springframework.ui.Model;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

@Service
public class CategoryService {
    @Resource
    private EbProductMapper ebProductMapper;

    public Map<String, Page> sCategoryProduct(int cid,int page,int pageSize){
        System.out.println("接收到小分类查询......");
        Map<String, Page> result = new HashMap<>();
        //TODO 1.
        Page page1 = new Page(page, pageSize);
        Page productPage = ebProductMapper.selectPage(page1,
                new QueryWrapper<EbProduct>().eq("epc_child_id", cid));
        System.out.println("已查询商品数据");

        result.put("sCategoryProductPage",productPage);
        return result;
    }
}
